package com.example.dsplatform.Service.ipml;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.dsplatform.Dao.Mapper.LogsMapper;
import com.example.dsplatform.Dao.Mapper.OrderMapper;
import com.example.dsplatform.Dao.Mapper.UserMapper;
import com.example.dsplatform.Service.LogsService;
import com.example.dsplatform.Service.OrderService;
import com.example.dsplatform.pojo.Entity.Logs;
import com.example.dsplatform.pojo.Entity.Order;
import com.example.dsplatform.pojo.Entity.ResponseResult;
import com.example.dsplatform.pojo.Entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogsServiceIpml extends ServiceImpl<LogsMapper,Logs> implements LogsService {
    @Autowired
    LogsMapper logsMapper;

    @Override
    public ResponseResult addLogs(Logs logs) {
            logsMapper.insert(logs);
            return new ResponseResult(200,"添加日志成功");
    }

    @Override
    public ResponseResult deleteLogs(Logs logs) {
        logsMapper.deleteById(logs.getId());
        return new ResponseResult(200,"删除日志成功");
    }

    @Override
    public ResponseResult updateLogs(Logs logs) {
        logsMapper.updateById(logs);
        return new ResponseResult(200,"修改日中成功");
    }


    @Override
    public ResponseResult selectLogs() {

        List list =logsMapper.selectList(null);
        return new ResponseResult(200,"查询订日志成功",list);
    }
}
